//
//  DataToolsControl.h
//  Btpin
//
//  Created by Vic on 2019/3/10.
//  Copyright © 2019 Vic. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "PublicAllCategoryInfoModel.h"
#import <WXApi.h>
#import "CompanyBaseInfoModel.h"
#import "ChatSentenceModel.h"

typedef void(^CompletionBlock)(NSDictionary * _Nullable resultDic);

typedef void (^requestBlock)(BOOL requestFlag);

typedef void (^requestSuccessBlock)(NSDictionary * _Nullable responseObject);
typedef void (^requestFailureBlock)(NSError * _Nullable error);

typedef NS_OPTIONS(NSUInteger, IDType) {
    IDTypeOfDefault                 =       0,
    IDTypeOfCompany                 =  1 << 1,  // 企业
    IDTypeOfFreshGraduate           =  1 << 2,  // 应届生
    IDTypeOfWorker                  =  1 << 3   // 职场人
};

typedef NS_OPTIONS(NSUInteger, OpenSigninType) {
    OpenSigninTypeOfDefault             =       0,
    OpenSigninTypeOfWXSignin            =  1 << 1,  // 微信授权--账号密码登录页
    OpenSigninTypeOfWXRegister          =  1 << 2,  // 微信授权--注册页
    OpenSigninTypeOfWXSigninForCaptcha  =  1 << 3   // 微信授权--验证码登录页
};

typedef NS_OPTIONS(NSUInteger, SigninType) {
    SigninTypeOfDefault                 =       0,
    SigninTypeOfCompanySingninSuccess   =  1 << 1,  // 企业--登录--成功
    SigninTypeOfCompanySingninFailure   =  1 << 2,  // 企业--登录--失败
    SigninTypeOfCompanyRegisterSuccess  =  1 << 3,  // 企业--注册--成功
    SigninTypeOfCompanyRegisterFailure  =  1 << 4,  // 企业--注册--失败
    SigninTypeOfPersonalSingninSuccess  =  1 << 5,  // 职场人/个人----登录--成功
    SigninTypeOfPersonalSingninFailure  =  1 << 6,  // 职场人/个人--登录--失败
    SigninTypeOfPersonalRegisterSuccess  =  1 << 7, // 职场人/个人----注册--成功
    SigninTypeOfPersonalRegisterFailure  =  1 << 8  // 职场人/个人--注册--失败
};

typedef NS_OPTIONS(NSUInteger, UploadImgType) {
    UploadImgTypeOfDefault          =       0,
    UploadImgTypeOfHeader           =  1 << 1, // 头像
    UploadImgTypeOfEduCert          =  1 << 2, // 学历证书
    UploadImgTypeOfProject          =  1 << 3, // 项目图片
    UploadImgTypeOfCertificateImg   =  1 << 4, // 企业执照
    UploadImgTypeOfCompanyLogo      =  1 << 5, // 企业LOGO
    UploadImgTypeOfCompanyImg       =  1 << 6, // 企业风采
    UploadImgTypeOfResumeWork       =  1 << 7, // 工作经历图片
    UploadImgTypeOfResumeImg        =  1 << 8, // 简历个人风采
    UploadImgTypeOfResumeCredent    =  1 << 9, // 获得证书图片
    UploadImgTypeOfResumeTraining   =  1 << 10,// 简历培训经历图片
    UploadImgTypeOfWeixin           =  1 << 11,// 微信二维码
    UploadImgTypeOfIDCard           =  1 << 12 // 身份证
};

@protocol DataToolsControlWXDelegate <NSObject>
@optional
- (void)dataToolsManagerWXDidRecvPaymentResponse:(nullable PayResp *)resp;
@end

@interface DataToolsControl : NSObject <WXApiDelegate>

@property (nonatomic, assign) id<DataToolsControlWXDelegate> _Nullable delegate;

+ (instancetype _Nullable )sharedManager;

@property (nonatomic, assign) BOOL isTIMLoginSuccess; // YES：登录成功 NO：失败（未登录）
//@property (strong, nonatomic) NSData * _Nullable deviceToken;

@property (nonatomic, assign) BOOL appJustOpen;
@property (nonatomic, assign) BOOL validJob; // 招聘者身份，是否有有效的职位，作为聊天的判断 YES：有 NO：没有

@property (nonatomic, assign) BOOL  isApple; // 是否是Apple登录
@property (nonatomic, copy) NSString * _Nullable isWXSigninCode; // 微信授权code
@property (nonatomic, copy) NSString * _Nullable isWXSigninToken; // 微信授权后open login返回的token
@property (nonatomic, assign) NSInteger codeRecord; // 目前架构会出现问题，记录一下，授权后只执行一次接口调用
@property (nonatomic, assign) OpenSigninType openSigninType; // 记录f当前是在哪个页面进行的登录授权（通知会全部通知，方法都会执行）

/**
 用户身份：应届生、职场人士、企业用户
 */
@property (nonatomic, assign) IDType idType;

@property (nonatomic, assign) SigninType signinType;

// 聊天常用语
@property (nonatomic, strong) NSMutableArray<ChatSentenceModel *> *chatSentenceArray;

/**
 所有公共分类数据
 */
@property (nonatomic, strong) PublicAllCategoryInfoModel * _Nullable allCategoryInfoModel;

@property (nonatomic, strong) CompanyBaseInfoModel * _Nullable companyBaseInfoModel;
/**
 处理用户信息数据

 @param infoDic 接口用户数据
 */
+ (void)dataAnalysisUserInfo:(NSDictionary *_Nullable)infoDic;


/**
 企业基本信息部分信息

 @param responseObject 部分信息
 */
+ (void)dataAnalysisUserBaseInfoForCompany:(NSDictionary *_Nullable)responseObject;

+ (void)deallocUserData;

#pragma mark - 自动登录
+ (void)autoLogin;
#pragma mark - 初始化IM
+ (void)autoLoginForInitIM;
#pragma mark - 初始化IM相关配置
+ (void)initIMPeizhi;
#pragma mark - 帐号-获取我的基本信息
+ (void)getMyBaseInfo;
#pragma mark - 帐号-获取我的基本信息(求职用户)
+ (void)getMyBaseInfoForWorker:(requestBlock _Nullable )requestBackBlock;
#pragma mark - 帐号-获取我的基本信息(招聘者)
+ (void)getMyBaseInfoForCompany:(requestBlock _Nullable )requestBackBlock;

#pragma mark - 获取公共分类
+ (void)getPublicAllCategory;
+ (void)getPublicCountryCode;
#pragma mark - 处理国家/地区编码数据
+ (void)handleCountryCodesData:(NSDictionary *)data;
+ (void)getPublicJobCats;
#pragma mark - 处理职位类别数据
+ (void)handleJobCatsData:(NSDictionary *_Nullable)data;
#pragma mark - 职位类别二三级数据处理
+ (NSMutableArray *_Nullable)handleJobCatsLevel:(PublicCategoryElementModel * _Nullable)itemModel;

#pragma mark - 图片上传
+ (void)uploadImgType:(UploadImgType)type image:(UIImage *_Nullable)image successBlock:(requestSuccessBlock _Nullable )success failurBlock:(requestFailureBlock _Nullable )failure;

+ (void)dataAnalysisUserBaseInfo:(NSDictionary *_Nullable)responseObject;

#pragma mark - 薪资区间
+ (NSArray *_Nullable)wageRange;

@end
